import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableNativeFeedback,
} from 'react-native';

/**
 * 普通数据行
 * "l": 键MC,
 * "n": 键DM,
 * "v": 1969-11-02,
 */
export default class HeadLine extends Component {
    render() {
        return (
            <TouchableNativeFeedback
                style={{flexDirection: 'row'}}
                background={TouchableNativeFeedback.SelectableBackground()}>
                <View style={styles.flexTop}>
                    <View style={styles.title}>
                        <Text style={styles.titleText}>{this.props.item.l}</Text>
                    </View>
                    <View style={styles.value}>
                        <Image style={styles.valuePic} source={{uri: 'data:image/png;base64,' + this.props.item.v}} />
                    </View>
                </View>
            </TouchableNativeFeedback>

        );
    }
}

//样式定义
const styles = StyleSheet.create({
    flexTop:{
        flexDirection:'row',
    },
    title:{
        flex: 1,
    },
    value:{
        flex: 3,
    },
    titleText:{
        color: '#494949',
        padding: 4,
    },
    valuePic:{
        height: 180,
        width:120,
        alignSelf: 'flex-start',
        padding: 4,
        borderWidth:1,
        borderColor: '#b2e866',
        margin: 2,
    },
});